/*
 * ParcelableAreaInfo.cpp
 *
 *  Created on: 2018-6-25
 *      Author: root
 */

#include "android/poi/ParcelableAreaInfo.h"
#include <binder/Parcel.h>

namespace android {
namespace poi {

ParcelableAreaInfo::ParcelableAreaInfo(String16 f_province, String16 f_city, String16 f_area, double f_longitude, double f_latitude) {
	province = f_province;
	city = f_city;
	area = f_area;
	longitude = f_longitude;
	latitude = f_latitude;
}

ParcelableAreaInfo::~ParcelableAreaInfo() {
	// TODO Auto-generated destructor stub
}



status_t ParcelableAreaInfo::writeToParcel(Parcel* parcel) const {
    status_t res;
    if (parcel == nullptr)
        return BAD_VALUE;
    res = parcel->writeString16(province);
    if (res != OK)
        return res;
    res = parcel->writeString16(city);
    if (res != OK)
        return res;
    res = parcel->writeString16(area);
    if (res != OK)
        return res;
    res = parcel->writeDouble(longitude);
    if (res != OK)
        return res;
    res = parcel->writeDouble(latitude);
    return res;
}

status_t ParcelableAreaInfo::readFromParcel(const Parcel* parcel) {
    status_t res;
    if (parcel == nullptr)
        return BAD_VALUE;
    res = parcel->readString16(&province);
    if (res != OK)
        return res;
    res = parcel->readString16(&city);
    if (res != OK)
        return res;
    res = parcel->readString16(&area);
    if (res != OK)
        return res;
    res = parcel->readDouble(&longitude);
    if (res != OK)
        return res;
    res = parcel->readDouble(&latitude);
    return res;
}


} /* namespace poi */
} /* namespace android */
